package com.wyz.rabbitmqconsumer.service.ttl;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;

/**
 * ttl + dead  实现延时队列
 */
@Component
@RabbitListener(queues = {"dead.direct.queue"})
public class TTLDirectSmsService {

    @RabbitHandler
    public void reviceSmsMessage(String msg, Channel channel, CorrelationData correlationData,
                                 @Header(AmqpHeaders.DELIVERY_TAG) long tag){

        System.out.println("ttl.direct.queue：" + msg);


    }
}
